package com.cyj.dream.admin.persistence.manager.systems;

import com.alibaba.fastjson.JSONObject;
import com.cyj.dream.admin.model.system.SysIconElement;
import com.cyj.dream.admin.persistence.service.ITbSysIconElementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description: 系统icon图标模块管理器类
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.persistence.manager.systems
 * @Author: ChenYongJia
 * @CreateTime: 2021-04-16 10:12
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Slf4j
@Component
public class SysIconElementManager {

    @Autowired
    private ITbSysIconElementService iTbSysIconElementService;
    
    /**
     * 添加饿了么组件图标模块数据
     * @param sysIconElement icon实体对象
     * @return boolean
     * @date 2021/4/16 10:14
     * @author ChenYongJia
     * @version 1.0
     */
    public boolean addIconElement(SysIconElement sysIconElement){
        log.info("进入 SysIconElementManager 添加饿了么组件图标模块数据方法，传入参数为：{}", JSONObject.toJSONString(sysIconElement));
        try {
            return iTbSysIconElementService.save(sysIconElement);
        } catch (Exception e){
            log.error("添加饿了么组件图标模块数据执行错误参数为======>e：{}", e);
            return false;
        }
    }

    /**
     * 查询饿了么组件所有图标信息
     * @return com.dream.DreamChardonnay.constant.model.Response<java.util.List<com.dream.DreamChardonnay.model.system.SysIconElement>>
     * @date 2021-4-16 10:22:30
     * @author ChenYongJia
     * @version 1.0
     */
    public List<SysIconElement> findAllIconList(){
        log.info("进入 SysIconElementManager 查询全部饿了么组件图标模块数据方法");
        return iTbSysIconElementService.list();
    }
    
}
